function AddNewRow(tableId,aColumns,Id,rowNumber){
	var tmpRowNumber = rowNumber || -1;
	var tbl = document.getElementById(tableId);
	var row = tbl.insertRow(tmpRowNumber);
	
	row.Id = tableId + "_row_" +Id;
	for(var i = 0; i < aColumns.length; i++){
		var cell = row.insertCell(-1);
		cell.innerHTML = aColumns[i];
	}	
	
	return row.Id
}


function getRowCount(tableId){
	var tbl = document.getElementById(tableId);	
	return tbl.rows.length;
}

function getCurrentRowIndex(object){
	
	var row = object.parentNode.parentNode;
	var rIndex = row.sectionRowIndex;
	
	return rIndex;
	
}

function getCurrentRow(object){
	
	var row = object.parentNode.parentNode;
	
	return row;
	
}

function deleteCurrentRow(object){
	
	var delRow = object.parentNode.parentNode;
	var tbl = delRow.parentNode.parentNode;
	var rIndex = delRow.sectionRowIndex;
	var rowArray = new Array(delRow);
	deleteRows(rowArray);
}

function deleteRows(rowObjArray){
	
	for (var i=0; i<rowObjArray.length; i++) {
		var rIndex = rowObjArray[i].sectionRowIndex;
		
		var tbl = rowObjArray[i].parentNode;
		
		tbl.deleteRow(rIndex);
	}
	
}